package experiment9;

import java.io.*;
import java.util.Scanner;

public class No_4 {
    public static void main(String []args) throws IOException {
        String input_filepath;
        String output_filepath;

        Scanner input=new Scanner(System.in);
        System.out.println("Enter the name of the origin file");
        input_filepath=System.getProperty("user.dir")+ File.separator+input.nextLine();
        System.out.println("Enter the name of the final file");
        output_filepath=System.getProperty("user.dir")+File.separator+input.nextLine();

        File input_file=new File(input_filepath);
        File output_file=new File(output_filepath);
        output_file.createNewFile();

        /**读取内容*/
        //存储文章内容
        StringBuffer mainStr=new StringBuffer();
        BufferedReader reader=new BufferedReader(new FileReader(input_file));
        String tempStr;
        int i=0;
        while ((tempStr=reader.readLine())!=null){
            i++;
            mainStr.append(tempStr);
            mainStr.append("\n");
        }
        reader.close();

        /**开始加密*/
        byte[] main_byte=mainStr.toString().getBytes();
        for (int j=0;j<main_byte.length;j++){
            main_byte[j]+=5;
        }

        String result=new String(main_byte);
        OutputStream outputStream=new FileOutputStream(output_file);
        outputStream.write(result.getBytes());
    }
}
